package org.xwb;

import reactor.core.publisher.Flux;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

public class FluxDemo {
    public static void main(String[] args) {
        Flux.range(1,10)
//                .doOnNext(integer -> System.out.println("doOnNext:"+integer))
//                .doOnEach(integerSignal -> { //each封装的详细
//                    System.out.println("doOnEach.." + integerSignal);
//                })
                .delayElements(Duration.ofSeconds(1))
//                .doOnNext(integer -> System.out.println("doOnNext02:"+integer))
                .subscribe(System.out::println);


        try {
            TimeUnit.SECONDS.sleep(20);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
